<?php

    require_once('../classes/mysql.php'); //utile ?
    require_once('../classes/user.class.php');
    require_once '../classes/news_manager.class.php';
    
    if(session_id()=="") session_start ();
    
    $news_manager;
    
  /*  if(isset($_SESSION['news_manager'])){
         $news_manager = $_SESSION['news_manager'];
    }else{*/
        $_SESSION['news_manager'] = new news_manager();
        $news_manager = $_SESSION['news_manager'];
   // }
        $page=1;
        if(isset($_GET['num_page']))
            $page=$_GET['num_page'];
    
    $return =  '{ "state":"ok","total":"'.$news_manager->get_total_news().'","news_array":'.$news_manager->get_next_news($page,'JSON').'}';
    
    echo $return;
    
    
?>
